﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Asp/admin.master" AutoEventWireup="true" CodeFile="add_model.aspx.cs" Inherits="Admin_Asp_add_model" EnableSessionState="True" %>
<%@ Register Src="~/Admin/Asp/UserControls/TextureSelection.ascx" TagName="TextureSelection" TagPrefix="uc" %>
<%@ Register Src="~/Admin/Asp/UserControls/ShaderSelection.ascx" TagName="ShaderSelection" TagPrefix="uc" %>
<%@ Register Src="~/Admin/Asp/UserControls/ThumbnailSelection.ascx" TagName="ThumbnailSelection" TagPrefix="uc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script src="../js/add_model.js" type="text/javascript" ></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="main_placeholder" Runat="Server">
    
    <h2>Add Model</h2>    
    <div class="notice">
        <p>
            This is where you add new models to your model viewer. If you're uploading <strong>.fbx</strong> files then it might ask your <strong>antivirus to allow FbxConverter.exe</strong>, 
            if converting an .fbx file it can take a <strong>few minutes</strong> if the model has many triangles or complex animations.
            <br /><br />
            Below is a list of what you can give the model item. <strong>Bold</strong> means it's required. 
        </p>
        <ul>
            <li><strong>Name:</strong> The name of the model item</li>
            <li><strong>Input Path:</strong> The model you want to upload, can be <strong>.obj, .fbx</strong></li>
            <li><strong>Output Name:</strong> The name of the model you're uploading, it will be placed in the <i>root/Models/</i> folder. It will <strong>automatically</strong> choose the right file extension depending on input file. 
                If you check the checkbox it will overwrite file with same name if it exists. Otherwise it will add _1 to the end of the file.
            </li>
            <li><strong>Thumbnail:</strong> The visible thumbnail in the model viewer</li>
            <li><strong>Shaders:</strong> You need to have at least 1 shader</li>
            <li>[ Textures ]: To have the shaders work properly they need textures but it's not a requirement. The different textures types are: <strong>Diffusal, Normal</strong>  </li>            
        </ul>         
    </div>
    
    <div id="model_edit">
        <label class="labelHeader">Name:</label> <br />
        <asp:TextBox ID="x_name" runat="server" OnTextChanged="NameChanged" ClientIDMode="Static" /> <br />
        <label class="labelHeader">Input Path:</label><br />
        <label class="labelNotice">*.fbx, *.obj</label><br />
        <asp:FileUpload ID="x_inputFile" runat="server" onchange="Gorbatras.Admin.FileControl.FileuploadChange( this, 'x_outputPath', [ '.fbx', '.obj' ], '' ); Gorbatras.Admin.AddModel.UpdateInput( this, '#x_inputPanel', '#x_inputLabel' );"  />         
        <br />
        <asp:Panel ID="x_inputPanel" runat="server" Visible="false" ClientIDMode="Static">
            <label class="labelNotice">Model file chosen:</label><br />
            <asp:Label ID="x_inputLabel" runat="server" ClientIDMode="static" />
            <br />
        </asp:Panel>
        <label class="labelHeader">Output Name:</label> <br />
        <label class="labelNotice">Don't add a file extension</label><br />
        <asp:TextBox ID="x_outputPath" runat="server" OnTextChanged="OutputChanged" ClientIDMode="Static" /> 
        <asp:CheckBox ID="x_outputOverwrite" runat="server" /> <label class="labelNotice">Overwrite file if it exists</label>
        <br />
        <!-- thumbnail -->
        <label class="labelHeader">Thumbnail:</label><br />
        <div class="presentation">
            <div class="presentation_left">
                <asp:Label ID="x_thumbnail_label" runat="server" />         
                <asp:Image ID="x_thumbnail_image" AlternateText="" runat="server" CssClass="thumbnail rightAlign" />
            </div>
            <div class="presentation_right">
                <asp:Button ID="x_thumbnailChange" runat="server" Text="Edit Thumbnail" OnClick="ThumbnailChange" /><br />
            </div>
            <div style="clear:both"></div>
        </div>
        <!-- shaders -->
        <label class="labelHeader">Shaders:</label><br />
        <div class="presentation">
            <div class="presentation_left">
                <asp:Label ID="x_shaders" runat="server" />              
            </div>
            <div class="presentation_right">
                <asp:Button ID="x_shadersChange" runat="server" Text="Edit Shaders" OnClick="ShadersChange" /><br />
            </div>
            <div style="clear:both"></div>
        </div>
        <br />
        <label class="labelHeader">Textures:</label>
        <br />

        <!-- diffuse -->
        <label class="labelHeader">Diffuse Map</label><br />
        <div class="presentation">
            <div class="presentation_left">
                <asp:Label ID="x_diffuseLabel" runat="server" />         
                <asp:Image ID="x_diffuseImage" AlternateText="" runat="server" CssClass="thumbnail rightAlign" />
            </div>
            <div class="presentation_right">
                <asp:Button ID="x_diffuseChange" runat="server" Text="Edit Diffuse Map" OnClick="DiffuseChange" /><br />
            </div>
            <div style="clear:both"></div>
        </div>
        <label class="labelHeader">Normal Map</label><br />
        <div class="presentation">
            <div class="presentation_left">
                <asp:Label ID="x_normalLabel" runat="server" />         
                <asp:Image ID="x_normalImage" AlternateText="" runat="server" CssClass="thumbnail rightAlign" />
            </div>
            <div class="presentation_right">
                <asp:Button ID="x_normalChange" runat="server" Text="Edit Normal Map" OnClick="NormalChange" /><br />
            </div>
            <div style="clear:both"></div>
        </div>

        <asp:Label ID="x_errorMsg" runat="server" Visible="false" CssClass="validationError" />
        <br />
        <label class="labelNotice">This might take a while depending on the size of the model</label>
        <br />
        <asp:Button ID="x_addModel" runat="server" Text="Add The Model" OnClick="TryToAdd" />

    </div>      
    <uc:TextureSelection id="x_textureSelection" Visible="false" runat="server" />
    <uc:ShaderSelection id="x_shaderSelection" visible="false" runat="server" />
    <uc:ThumbnailSelection ID="x_thumbnailSelection" Visible="false" runat="server" />

        
</asp:Content>

